type IsNever2<T> = [T] extends [never] ? true : false;
type IsUnion2<U> = IsNever<U> extends true ? "" : U;

type BEM<
  B extends string,
  E extends string[],
  M extends string[]
> = `${B}${IsUnion2<`__${E[number]}`>}${IsUnion2<`--${M[number]}`>}`;

type E = ["warning", "success"];
type Un1 = IsUnion2<`__${E[number]}`>;
